using SharpGraphT.Sharp.System.Collections.Generic;

namespace SharpGraphT.Graph.Specifics;

[Serializable]
public class UndirectedEdgeContainer<TV, TE> {
    private static readonly long SerialVersionUid = -6623207588411170010L;

    internal IReadOnlyableSet<TE> VertexEdges { get; set; }

    internal UndirectedEdgeContainer(IEdgeSetFactory<TV, TE> edgeSetFactory,
        TV vertex) =>
        VertexEdges = edgeSetFactory.CreateEdgeSet(vertex);

    public IReadOnlySet<TE> GetUnmodifiableVertexEdges() => VertexEdges;

    public void AddEdge(TE e) => VertexEdges.Add(e);

    public int EdgeCount => ((ISet<TE>) VertexEdges).Count;

    public void RemoveEdge(TE e) => VertexEdges.Remove(e);
}